home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-07 | 2.7 KB | 101 lines | [TEXT/MPCC] |
- // ----------------------------------------------------------------------------------
- // EventLoop.c
- // ----------------------------------------------------------------------------------
- // Main event loop for a standard Macintosh application
- //
- // This demo is copywrite 1994 by LexTek Internation. Feel free to use it for
- // whatever purpose you wish. The SpellWright Library may not be copied or
- // distributed, except when linked to your application that adds significant features
- // to the code. ie. you can't take the library, make a new library and sell it. You
- // can, however, use it without royalties in applications or other such projects.
- //
- // LexTek International
- // 2255 N. University Parkway, Suit 15
- // Provo, UT 84604
- // (801) 375.8332 Phone
- // (801) 375.7654 Fax
- //
- // ----------------------------------------------------------------------------------
- // History:
- // 9/11/94 Clark Goble Original
- //
-
-
- #include "MenuHandler.h"
- #include "Globals.h"
- #include "WindowHandler.h"
-
- void ChooseFont(short);
- void ChooseStyle(short);
-
- // ----------------------------------------------------------------------------------
- // ChooseFont
- // ----------------------------------------------------------------------------------
- // Given a menu item this chooses the appropriate font and sets the TE selection
- // to that font.
-
- void ChooseFont(short theItem)
- {
- TEHandle theTE;
- TextStyle theStyle;
-
- MenuHandle fontMenu;
- short fontNum;
- Str255 fontName;
-
- if (gDocWindow == nil)
- return; // no window
-
- theTE = (TEHandle) GetTE(gDocWindow);
-
- fontMenu = GetMHandle(mFont);
-
- GetItem( fontMenu, theItem, fontName);
-
- GetFNum(fontName, &fontNum);
-
- theStyle.tsFont = fontNum;
- TESetStyle(doFont, &theStyle, true, theTE);
-
- return;
-
-
- } // ChooseFont
-
- // ----------------------------------------------------------------------------------
- // ChooseStyle
- // ----------------------------------------------------------------------------------
- // Given a menu item this chooses the appropriate style and sets the TE selection
- // to that font.
-
- void ChooseStyle(short theItem)
- {
-
- TEHandle theTE;
- TextStyle theStyle;
-
- // arrays representing the value for that menu item number
-
- static Style styleTable[] = { 0, bold, italic, underline, outline,
- shadow, condense, extend};
- static short sizeTable[] = {9, 10, 12, 14, 18, 24};
-
- if (gDocWindow == nil)
- return; // no window
-
- theTE = (TEHandle) GetTE( gDocWindow);
-
- if (theItem < iline51)
- { theStyle.tsSize = sizeTable[theItem - 1];
- TESetStyle(doSize, &theStyle, true, theTE);
- return;
- }
- else if (theItem < iExtend)
- { theStyle.tsFace = styleTable[theItem - iPlain];
- TESetStyle(doFace, &theStyle, true, theTE);
- return;
- } // if
- } // ChooseStyle
-
-
-